package com.quiz.bis.mapper;

import com.quiz.bis.domain.model.ExamSubgroup;
import com.quiz.common.mybatis.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 考试子分组持久层接口
 *
 * @author ahuan
 */
@Mapper
public interface ExamSubgroupMapper extends BaseMapperPlus<ExamSubgroup> {
    @Select("SELECT * FROM exam_subgroups WHERE exam_group_id = #{groupId} AND del_flag = 0")
    List<ExamSubgroup> selectByGroupId(@Param("groupId") Long groupId);

    @Select("SELECT COUNT(*) FROM exam_subgroup_members WHERE subgroup_id = #{subgroupId} AND del_flag = 0")
    Integer countMembers(@Param("subgroupId") Long subgroupId);
}